package interview;

import java.util.LinkedList;
import java.util.List;
import java.util.Queue;

/**
 * description: 订单遍历转换
 *
 * @author RenShiWei
 * Date: 2022/2/23 15:28
 **/
public class OrderTest {

    /**
     * 订单实体
     */
    class OrderDTO {

        /** 订单类型 */
        private String type;
        /** 订单来源 */
        private String source;
        /** 租户id */
        private String tenantId;

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public String getSource() {
            return source;
        }

        public void setSource(String source) {
            this.source = source;
        }

        public String getTenantId() {
            return tenantId;
        }

        public void setTenantId(String tenantId) {
            this.tenantId = tenantId;
        }
    }

    /**
     * 将无序的订单信息 转为 订单集合
     *
     * @param typeList     /
     * @param sourceList   /
     * @param tenantIdList /
     * @return 转换后的订单集合
     */
    public List<OrderDTO> bfs(List<String> typeList, List<String> sourceList, List<String> tenantIdList) {
        List<OrderDTO> res = new LinkedList<>();

        Queue<String> q = new LinkedList<>();
        // 添加第一层
        for (String type : typeList) {
            q.offer(type);
        }

        while (! q.isEmpty()) {
            OrderDTO orderDTO = new OrderDTO();
            int typeSize = q.size();
            for (int i = 0; i < typeSize; i++) {
                // 每种 type的可能性
                String curType = q.poll();
                orderDTO.setType(curType);

                if (! sourceList.isEmpty()) {
                    
                }

            }


        }


        return res;
    }


}

